//
// Created by jinbang.li on 2023/8/6.
//

#include "OpPlayerBuilder.h"

#include "../Demux/OpFFDemux.h"
#include "../Decode/OpFFDecode.h"
#include "../Audio/OpFFResample.h"
#include "../Audio/OpSLAudioPlay.h"
#include "../Video/OpVideoView.h"
OpPlayerBuilder* OpPlayerBuilder::get() {
    static OpPlayerBuilder opPlayerBuilder;
    return &opPlayerBuilder;
}
IOpDemux* OpPlayerBuilder::createDemux() {
    IOpDemux* demux = new OpFFDemux();
    return demux;
};
IOpDecode* OpPlayerBuilder::createDecode() {
    IOpDecode* decode = new OpFFDecode();
    return decode;
};
IOpResample* OpPlayerBuilder::createResample(){
    IOpResample* resample = new OpFFResample();
    return resample;
};
IOpAudioPlay* OpPlayerBuilder::createAudioPlay() {
    IOpAudioPlay* audioPlay = new OpSLAudioPlay();
    return audioPlay;
};
IOpVideoView* OpPlayerBuilder::createVideoView(){
    IOpVideoView* videoView = new OpVideoView();
    return videoView;
};
IOpPlayer* OpPlayerBuilder::createPlayer(unsigned char index){
   IOpPlayer* player = IOpPlayer::get(index);
    return player;
};

void OpPlayerBuilder::initHard(void *vm) {
    OpFFDecode::InitHard(vm);
}

